unit RDuplicata;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, RLReport, RLParser, RLPrintDialog, RLSaveDialog, RLPreviewForm,
  RLPreview;

type
  TFormRDuplicata = class(TForm)
    RLReport1: TRLReport;
    RLBand1: TRLBand;
    RLGroup1: TRLGroup;
    RLDBText10: TRLDBText;
    RLImage1: TRLImage;
    RLDBText31: TRLDBText;
    RLDBText32: TRLDBText;
    RLLabel33: TRLLabel;
    RLLabel34: TRLLabel;
    RLBand7: TRLBand;
    RLLabel8: TRLLabel;
    RLLabel11: TRLLabel;
    RLLabel12: TRLLabel;
    RLLabel13: TRLLabel;
    RLLabel14: TRLLabel;
    RLDBText9: TRLDBText;
    RLLabel15: TRLLabel;
    RLDBText12: TRLDBText;
    RLLabel17: TRLLabel;
    RLBand8: TRLBand;
    RLLabel16: TRLLabel;
    RLLabel18: TRLLabel;
    RLLabel19: TRLLabel;
    RLDBText13: TRLDBText;
    RLDBText14: TRLDBText;
    RLDBText15: TRLDBText;
    RLDBText16: TRLDBText;
    RLDBText17: TRLDBText;
    RLDBText18: TRLDBText;
    RLDBText19: TRLDBText;
    RLBand6: TRLBand;
    RLLabel20: TRLLabel;
    RLLabel21: TRLLabel;
    RLDBText20: TRLDBText;
    RLBand2: TRLBand;
    RLBand3: TRLBand;
    RLBand4: TRLBand;
    RLLabel1: TRLLabel;
    RLLabel4: TRLLabel;
    RLDBText1: TRLDBText;
    RLLabel2: TRLLabel;
    RLLabel3: TRLLabel;
    RLLabel5: TRLLabel;
    RLLabel6: TRLLabel;
    RLLabel7: TRLLabel;
    RLDraw1: TRLDraw;
    RLDBText3: TRLDBText;
    RLLabel9: TRLLabel;
    RLLabel10: TRLLabel;
    RLLabel22: TRLLabel;
    procedure RLBand1BeforePrint(Sender: TObject; var PrintIt: Boolean);
    procedure RLDBText9BeforePrint(Sender: TObject; var Text: String;
      var PrintIt: Boolean);
    procedure RLLabel20BeforePrint(Sender: TObject; var Text: String;
      var PrintIt: Boolean);
    procedure RLLabel3BeforePrint(Sender: TObject; var Text: String;
      var PrintIt: Boolean);
    procedure RLBand5BeforePrint(Sender: TObject; var PrintIt: Boolean);
    procedure RLDBText3BeforePrint(Sender: TObject; var Text: String;
      var PrintIt: Boolean);
    procedure RLDBText13BeforePrint(Sender: TObject; var Text: String;
      var PrintIt: Boolean);
    procedure RLDBText20BeforePrint(Sender: TObject; var Text: String;
      var PrintIt: Boolean);
    procedure RLDBText14BeforePrint(Sender: TObject; var Text: String;
      var PrintIt: Boolean);
    procedure RLDBText15BeforePrint(Sender: TObject; var Text: String;
      var PrintIt: Boolean);
    procedure RLDBText16BeforePrint(Sender: TObject; var Text: String;
      var PrintIt: Boolean);
    procedure RLDBText17BeforePrint(Sender: TObject; var Text: String;
      var PrintIt: Boolean);
    procedure RLDBText18BeforePrint(Sender: TObject; var Text: String;
      var PrintIt: Boolean);
    procedure RLDBText19BeforePrint(Sender: TObject; var Text: String;
      var PrintIt: Boolean);
    procedure RLLabel9BeforePrint(Sender: TObject; var Text: String;
      var PrintIt: Boolean);
    procedure RLLabel22BeforePrint(Sender: TObject; var Text: String;
      var PrintIt: Boolean);
  private
    { Private declarations }
    Obs : String;
  public
    { Public declarations }
  end;

var
  FormRDuplicata: TFormRDuplicata;

implementation

uses DMR, Geral, DMS, DB;

{$R *.dfm}

procedure TFormRDuplicata.RLBand1BeforePrint(Sender: TObject;
  var PrintIt: Boolean);
begin
    DMSr.dsEmpresaProp.DataSet.Open;
    if (GetParametro('LOGO') <> '') and ((pos('BMP',UpperCase(GetParametro('LOGO'))) > 0) or (pos('JPG',UpperCase(GetParametro('LOGO'))) > 0))then
        RLImage1.Picture.LoadFromFile(GetParametro('LOGO'));
end;

procedure TFormRDuplicata.RLDBText9BeforePrint(Sender: TObject;
  var Text: String; var PrintIt: Boolean);
begin
    Text := Text + ', '+ getcampoquery('cidade','(nome ||'+chr(39)+'-'+chr(39)+'|| uf) as cidade', 'codcidade', DMSr.dsEmpresaProp.dataset.fieldbyname('CODCIDADE').asstring);
end;

procedure TFormRDuplicata.RLLabel20BeforePrint(Sender: TObject;
  var Text: String; var PrintIt: Boolean);
begin
    Text := text +' '+ obs;
end;

procedure TFormRDuplicata.RLLabel3BeforePrint(Sender: TObject;
  var Text: String; var PrintIt: Boolean);
begin
    Text := Extenso(DMRel.dsRelat.dataset.FieldByName('VALORVENC').asfloat)
end;

procedure TFormRDuplicata.RLBand5BeforePrint(Sender: TObject;
  var PrintIt: Boolean);
begin
    PrintIt := False;
end;

procedure TFormRDuplicata.RLDBText3BeforePrint(Sender: TObject;
  var Text: String; var PrintIt: Boolean);
begin
    Text := DMRel.dsRelat.dataset.FieldByName('CODFATURA').AsString;
end;

procedure TFormRDuplicata.RLDBText13BeforePrint(Sender: TObject;
  var Text: String; var PrintIt: Boolean);
begin
    Text := DMRel.dsRelat.dataset.FieldByName('DATAEMISSAO').AsString;
end;

procedure TFormRDuplicata.RLDBText20BeforePrint(Sender: TObject;
  var Text: String; var PrintIt: Boolean);
begin
    Text := DMRel.dsRelat.dataset.FieldByName('DATAVENC').AsString;
end;

procedure TFormRDuplicata.RLDBText14BeforePrint(Sender: TObject;
  var Text: String; var PrintIt: Boolean);
begin
    Text := CurrToStrF(DMRel.dsRelat.dataset.FieldByName('VALORVENC').AsFloat,Ffnumber,2);
end;

procedure TFormRDuplicata.RLDBText15BeforePrint(Sender: TObject;
  var Text: String; var PrintIt: Boolean);
begin
    Text := DMRel.dsRelat.dataset.FieldByName('NOME').AsString;
end;

procedure TFormRDuplicata.RLDBText16BeforePrint(Sender: TObject;
  var Text: String; var PrintIt: Boolean);
begin
    Text := DMRel.dsRelat.dataset.FieldByName('ENDERECO').AsString;
end;

procedure TFormRDuplicata.RLDBText17BeforePrint(Sender: TObject;
  var Text: String; var PrintIt: Boolean);
begin
    Text := DMRel.dsRelat.dataset.FieldByName('CNPJ').AsString;
end;

procedure TFormRDuplicata.RLDBText18BeforePrint(Sender: TObject;
  var Text: String; var PrintIt: Boolean);
begin
    Text := DMRel.dsRelat.dataset.FieldByName('CIDADECLI').AsString;
end;

procedure TFormRDuplicata.RLDBText19BeforePrint(Sender: TObject;
  var Text: String; var PrintIt: Boolean);
begin
    Text := DMRel.dsRelat.dataset.FieldByName('IE').AsString;
end;

procedure TFormRDuplicata.RLLabel9BeforePrint(Sender: TObject;
  var Text: String; var PrintIt: Boolean);
begin
    text := DMRel.dsRelat.dataset.FieldByName('OBS1').AsString;
end;

procedure TFormRDuplicata.RLLabel22BeforePrint(Sender: TObject;
  var Text: String; var PrintIt: Boolean);
begin
    text := CurrToStrF (DMRel.dsRelat.dataset.FieldByName('desconto').AsFloat, ffCurrency, 2)   ;
end;

end.
